<template>
  <div class="app-container">
    <el-card class="box-card">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
        <el-form-item label="检查人" prop="name">
          <el-input
            v-model="queryParams.name"
            placeholder="请输入检查人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="身份证号" prop="idNumber">
                <el-input
                  v-model="queryParams.idNumber"
                  placeholder="请输入身份证号"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="工作单位" prop="workPlace">
          <el-select v-model="queryParams.workPlace" placeholder="请选择工作单位" clearable>
            <el-option
              v-for="dict in dict.type.yh_gas_station"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="工号" prop="userName">
          <el-input
            v-model="queryParams.userName"
            placeholder="请输入工号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="性别" prop="sex">
                <el-select v-model="queryParams.sex" placeholder="请选择性别" clearable>
                  <el-option
                    v-for="dict in dict.type.sys_user_sex"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </el-form-item>

              <el-form-item label="手机号" prop="phone">
                <el-input
                  v-model="queryParams.phone"
                  placeholder="请输入手机号"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="职位" prop="posts">
                <el-select v-model="queryParams.posts" placeholder="请选择职位" clearable>
                  <el-option
                    v-for="dict in dict.type.yh_posts"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="出生日期" prop="birth">
                <el-input
                  v-model="queryParams.birth"
                  placeholder="请输入出生日期"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="钢瓶瓶号" prop="cylinderNumber">
          <el-input
            v-model="queryParams.cylinderNumber"
            placeholder="请输入钢瓶瓶号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="钢瓶状态" prop="cylinderStatus" v-show="showSearch">
          <el-select v-model="queryParams.cylinderStatus" placeholder="请选择钢瓶状态" clearable>
            <el-option
              v-for="dict in dict.type.yh_cylinder_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="应充介质" prop="gasMedia" v-show="showSearch" >
          <el-select v-model="queryParams.gasMedia" placeholder="请选择应充介质" clearable>
            <el-option
              v-for="dict in dict.type.yh_medium"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <!--      <el-form-item label="钢瓶重量" prop="weight" v-show="showSearch">
                <el-input
                  v-model="queryParams.weight"
                  placeholder="请输入钢瓶重量"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="钢瓶容积" prop="volume" v-show="showSearch">
                <el-input
                  v-model="queryParams.volume"
                  placeholder="请输入钢瓶容积"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="所属气站" prop="belongingGasStation" >
          <el-select v-model="queryParams.belongingGasStation" placeholder="请选择所属气站" clearable>
            <el-option
              v-for="dict in dict.type.yh_gas_station"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
<!--        <el-form-item label="钢瓶生产日期" prop="manufactureDate" v-show="showSearch">
          <el-input
            v-model="queryParams.manufactureDate"
            placeholder="请输入钢瓶生产日期"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="钢瓶报废日期" prop="scrapDate" v-show="showSearch">
          <el-input
            v-model="queryParams.scrapDate"
            placeholder="请输入钢瓶报废日期"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>-->
<!--        <el-form-item label="气瓶制造单位" prop="manufacturingUnits" v-show="showSearch">
          <el-input
            v-model="queryParams.manufacturingUnits"
            placeholder="请输入气瓶制造单位"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>-->
        <el-form-item label="下次检验期限" prop="nextInspectionDeadline" v-show="showSearch">
          <el-input
            v-model="queryParams.nextInspectionDeadline"
            placeholder="请输入下次检验期限"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="瓶体外观检查" prop="visualInspertion" v-show="showSearch">
          <el-select v-model="queryParams.visualInspertion" placeholder="请选择瓶体外观检查" clearable>
            <el-option
              v-for="dict in dict.type.yh_visual_inspertion"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="涂色" prop="coloring" v-show="showSearch">
          <el-input
            v-model="queryParams.coloring"
            placeholder="请输入涂色"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="油污" prop="greasyDirt" v-show="showSearch">
          <el-input
            v-model="queryParams.greasyDirt"
            placeholder="请输入油污"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="余压" prop="residualPressure" v-show="showSearch">
          <el-input
            v-model="queryParams.residualPressure"
            placeholder="请输入余压"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="不明气体分析" prop="unidentifiedGasAnalysis" v-show="showSearch">
          <el-input
            v-model="queryParams.unidentifiedGasAnalysis"
            placeholder="请输入不明气体分析"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="出口螺纹样式" prop="exportThreadStyle" v-show="showSearch" >
          <el-select v-model="queryParams.exportThreadStyle" placeholder="请选择出口螺纹样式" clearable>
            <el-option
              v-for="dict in dict.type.yh_export_thread_style"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="充装压力" prop="fillingPressure" v-show="showSearch">
          <el-input
            v-model="queryParams.fillingPressure"
            placeholder="请输入充装压力"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="密封情况" prop="sealingSituation" v-show="showSearch" >
          <el-select v-model="queryParams.sealingSituation" placeholder="请选择密封情况" clearable>
            <el-option
              v-for="dict in dict.type.yh_sealing_situation"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="瓶体是否变形" prop="deformation" v-show="showSearch">
          <el-select v-model="queryParams.deformation" placeholder="请选择瓶体是否变形" clearable>
            <el-option
              v-for="dict in dict.type.yh_deformation"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="瓶温异常情况" prop="bottleTemperatureAbnormalities" v-show="showSearch">
          <el-select v-model="queryParams.bottleTemperatureAbnormalities" placeholder="请选择瓶温异常情况" clearable>
            <el-option
              v-for="dict in dict.type.yh_bottle_temperature_abnormalities"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <!--      <el-form-item label="用户ID" prop="userId">
                <el-input
                  v-model="queryParams.userId"
                  placeholder="请输入用户ID"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="单位ID" prop="deptId">
                <el-input
                  v-model="queryParams.deptId"
                  placeholder="请输入单位ID"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <br/>
        <div style="text-align:right;">

          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>

        </div>
        <br/>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['yzx:yinspection:add']"
          >新增
          </el-button>
        </el-col>
        <!--      <el-col :span="1.5">
                <el-button
                  type="success"
                  plain
                  icon="el-icon-edit"
                  size="mini"
                  :disabled="single"
                  @click="handleUpdate"
                  v-hasPermi="['yzx:yinspection:edit']"
                >修改</el-button>
              </el-col>-->
        <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="mini"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['yzx:yinspection:remove']"
          >删除
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['system:yinspection:export']"
          >导出
          </el-button>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
      </el-row>

      <el-table v-loading="loading" :data="yinspectionList" border @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center"/>
        <el-table-column type="index" label="序号" width="55" :index="indexMethod" align="center"/>
        <el-table-column label="检查人" align="center" prop="name" v-if="columns[0].visible"/>
        <!--      <el-table-column label="身份证号" align="center" prop="idNumber" />-->
        <el-table-column label="工作单位" align="center" prop="workPlace" v-if="columns[1].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_gas_station" :value="scope.row.workPlace"/>
          </template>
        </el-table-column>
        <!--      <el-table-column label="性别" align="center" prop="sex">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
                </template>
              </el-table-column>-->
        <el-table-column label="工号" align="center" prop="userName" v-if="columns[2].visible"/>
        <!--      <el-table-column label="手机号" align="center" prop="phone" />-->
        <!--      <el-table-column label="职位" align="center" prop="posts" v-if="columns[3].visible">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.yh_posts" :value="scope.row.posts"/>
                </template>
              </el-table-column>-->
        <!--      <el-table-column label="出生日期" align="center" prop="birth" />-->
        <el-table-column label="钢瓶瓶号" align="center" prop="cylinderNumber" v-if="columns[3].visible"/>
        <el-table-column label="钢瓶状态" align="center" prop="cylinderStatus" v-if="columns[4].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_cylinder_status" :value="scope.row.cylinderStatus"/>
          </template>
        </el-table-column>
        <el-table-column label="应充介质" align="center" prop="gasMedia" v-if="columns[5].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_medium" :value="scope.row.gasMedia"/>
          </template>
        </el-table-column>
        <!--      <el-table-column label="钢瓶重量" align="center" prop="weight"  v-if="columns[7].visible"/>
              <el-table-column label="钢瓶容积" align="center" prop="volume"  v-if="columns[8].visible"/>-->
        <el-table-column label="所属气站" align="center" prop="belongingGasStation" v-if="columns[6].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_gas_station" :value="scope.row.belongingGasStation"/>
          </template>
        </el-table-column>
<!--        <el-table-column label="钢瓶生产日期" align="center" prop="manufactureDate" v-if="columns[7].visible"/>
        <el-table-column label="钢瓶报废日期" align="center" prop="scrapDate" v-if="columns[8].visible"/>
        <el-table-column label="气瓶制造单位" align="center" prop="manufacturingUnits" v-if="columns[9].visible"/>-->
        <el-table-column label="下次检验期限" align="center" prop="nextInspectionDeadline" v-if="columns[7].visible"/>
        <el-table-column label="瓶体外观检查" align="center" prop="visualInspertion" v-if="columns[8].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_visual_inspertion" :value="scope.row.visualInspertion"/>
          </template>
        </el-table-column>
        <el-table-column label="涂色" align="center" prop="coloring" v-if="columns[9].visible"/>
        <el-table-column label="油污" align="center" prop="greasyDirt" v-if="columns[10].visible"/>
        <el-table-column label="余压" align="center" prop="residualPressure" v-if="columns[11].visible"/>
        <el-table-column label="不明气体分析" align="center" prop="unidentifiedGasAnalysis" v-if="columns[12].visible"/>
        <el-table-column label="出口螺纹样式" align="center" prop="exportThreadStyle" v-if="columns[13].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_export_thread_style" :value="scope.row.exportThreadStyle"/>
          </template>
        </el-table-column>
        <el-table-column label="充装压力" align="center" prop="fillingPressure" v-if="columns[14].visible"/>
        <el-table-column label="密封情况" align="center" prop="sealingSituation" v-if="columns[15].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_sealing_situation" :value="scope.row.sealingSituation"/>
          </template>
        </el-table-column>
        <el-table-column label="瓶体是否变形" align="center" prop="deformation" v-if="columns[16].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_deformation" :value="scope.row.deformation"/>
          </template>
        </el-table-column>
        <el-table-column label="瓶温异常情况" align="center" prop="bottleTemperatureAbnormalities" v-if="columns[17].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.yh_bottle_temperature_abnormalities"
                      :value="scope.row.bottleTemperatureAbnormalities"/>
          </template>
        </el-table-column>
        <!--      <el-table-column label="用户ID" align="center" prop="userId" />
              <el-table-column label="单位ID" align="center" prop="deptId" />-->
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['yzx:yinspection:edit']"
            >修改
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleDelete(scope.row)"
              v-hasPermi="['yzx:yinspection:remove']"
            >删除
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleView(scope.row)"
              v-hasPermi="['yzx:yinspection:xiangqing']"
            >详细
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <!-- 添加或修改气瓶检测对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-container>
          <el-main>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查人" prop="name">
                  <el-input v-model="form.name" placeholder="请输入检查人"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <!--        <el-form-item label="身份证号" prop="idNumber">
                          <el-input v-model="form.idNumber" placeholder="请输入身份证号" />
                        </el-form-item>-->
                <el-form-item label="工作单位" prop="workPlace">
                  <el-select v-model="form.workPlace" placeholder="请选择工作单位">
                    <el-option
                      v-for="dict in dict.type.yh_gas_station"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <!--        <el-form-item label="性别" prop="sex">
                          <el-select v-model="form.sex" placeholder="请选择性别">
                            <el-option
                              v-for="dict in dict.type.sys_user_sex"
                              :key="dict.value"
                              :label="dict.label"
                              :value="dict.value"
                            ></el-option>
                          </el-select>
                        </el-form-item>-->
                <el-form-item label="工号" prop="userName">
                  <el-input v-model="form.userName" placeholder="请输入工号"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <!--        <el-form-item label="手机号" prop="phone">
                          <el-input v-model="form.phone" placeholder="请输入手机号" />
                        </el-form-item>-->
                <!--        <el-form-item label="职位" prop="posts">
                          <el-select v-model="form.posts" placeholder="请选择职位">
                            <el-option
                              v-for="dict in dict.type.yh_posts"
                              :key="dict.value"
                              :label="dict.label"
                              :value="dict.value"
                            ></el-option>
                          </el-select>
                        </el-form-item>
                              </el-col>
                              <el-col :span="12">-->
                <!--        <el-form-item label="出生日期" prop="birth">
                          <el-input v-model="form.birth" placeholder="请输入出生日期" />
                        </el-form-item>-->
                <el-form-item label="钢瓶瓶号" prop="cylinderNumber">
                  <el-input v-model="form.cylinderNumber" placeholder="请输入钢瓶瓶号"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="钢瓶状态" prop="cylinderStatus">
                  <el-select v-model="form.cylinderStatus" placeholder="请选择钢瓶状态">
                    <el-option
                      v-for="dict in dict.type.yh_cylinder_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="应充介质" prop="gasMedia">
                  <el-select v-model="form.gasMedia" placeholder="请选择应充介质">
                    <el-option
                      v-for="dict in dict.type.yh_medium"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
<!--              <el-col :span="12">
                <el-form-item label="钢瓶重量" prop="weight">
                  <el-input v-model="form.weight" placeholder="请输入钢瓶重量"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="钢瓶容积" prop="volume">
                  <el-input v-model="form.volume" placeholder="请输入钢瓶容积"/>
                </el-form-item>
              </el-col>-->
              <el-col :span="12">
                <el-form-item label="所属气站" prop="belongingGasStation">
                  <el-select v-model="form.belongingGasStation" placeholder="请选择所属气站">
                    <el-option
                      v-for="dict in dict.type.yh_gas_station"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="钢瓶生产日期" prop="manufactureDate">
                  <el-input v-model="form.manufactureDate" placeholder="请输入钢瓶生产日期"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="钢瓶报废日期" prop="scrapDate">
                  <el-input v-model="form.scrapDate" placeholder="请输入钢瓶报废日期"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="气瓶制造单位" prop="manufacturingUnits">
                  <el-input v-model="form.manufacturingUnits" placeholder="请输入气瓶制造单位"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="下次检验期限" prop="nextInspectionDeadline">
                  <el-input v-model="form.nextInspectionDeadline" placeholder="请输入下次检验期限"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="瓶体外观检查" prop="visualInspertion">
                  <el-select v-model="form.visualInspertion" placeholder="请选择瓶体外观检查">
                    <el-option
                      v-for="dict in dict.type.yh_visual_inspertion"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="涂色" prop="coloring">
                  <el-input v-model="form.coloring" placeholder="请输入涂色"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="油污" prop="greasyDirt">
                  <el-input v-model="form.greasyDirt" placeholder="请输入油污"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="余压" prop="residualPressure">
                  <el-input v-model="form.residualPressure" placeholder="请输入余压"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="不明气体分析" prop="unidentifiedGasAnalysis">
                  <el-input v-model="form.unidentifiedGasAnalysis" placeholder="请输入不明气体分析"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="出口螺纹样式" prop="exportThreadStyle">
                  <el-select v-model="form.exportThreadStyle" placeholder="请选择出口螺纹样式">
                    <el-option
                      v-for="dict in dict.type.yh_export_thread_style"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="充装压力" prop="fillingPressure">
                  <el-input v-model="form.fillingPressure" placeholder="请输入充装压力"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="密封情况" prop="sealingSituation">
                  <el-select v-model="form.sealingSituation" placeholder="请选择密封情况">
                    <el-option
                      v-for="dict in dict.type.yh_sealing_situation"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="瓶体是否变形" prop="deformation">
                  <el-select v-model="form.deformation" placeholder="请选择瓶体是否变形">
                    <el-option
                      v-for="dict in dict.type.yh_deformation"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="瓶温异常情况" prop="bottleTemperatureAbnormalities">
                  <el-select v-model="form.bottleTemperatureAbnormalities" placeholder="请选择瓶温异常情况">
                    <el-option
                      v-for="dict in dict.type.yh_bottle_temperature_abnormalities"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <!--        <el-form-item label="用户ID" prop="userId">
                          <el-input v-model="form.userId" placeholder="请输入用户ID" />
                        </el-form-item>
                        <el-form-item label="单位ID" prop="deptId">
                          <el-input v-model="form.deptId" placeholder="请输入单位ID" />
                        </el-form-item>
                        <el-form-item label="备注" prop="remark">
                          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注1" prop="note1">
                          <el-input v-model="form.note1" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注2" prop="note2">
                          <el-input v-model="form.note2" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注3" prop="note3">
                          <el-input v-model="form.note3" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注5" prop="note4">
                          <el-input v-model="form.note4" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注4" prop="note5">
                          <el-input v-model="form.note5" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注6" prop="note6">
                          <el-input v-model="form.note6" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注7" prop="note7">
                          <el-input v-model="form.note7" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注8" prop="note8">
                          <el-input v-model="form.note8" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注9" prop="note9">
                          <el-input v-model="form.note9" type="textarea" placeholder="请输入内容" />
                        </el-form-item>
                        <el-form-item label="备注10" prop="note10">
                          <el-input v-model="form.note10" type="textarea" placeholder="请输入内容" />
                        </el-form-item>-->
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listYinspection,
  getYinspection,
  delYinspection,
  addYinspection,
  updateYinspection
} from "@/api/module/yzx/yzx_yinspection";

export default {
  name: "Yinspection",
  dicts: ['yh_sealing_situation', 'yh_medium', 'yh_export_thread_style', 'yh_cylinder_status', 'yh_visual_inspertion', 'yh_bottle_temperature_abnormalities', 'sys_user_sex', 'yh_gas_station', 'yh_deformation', 'yh_posts'],
  data() {
    return {
      columns: [
        {key: 0, label: `检查人`, visible: true},
        {key: 1, label: `工作单位`, visible: true},
        {key: 2, label: `工号`, visible: true},
       /* {key: 3, label: `职位`, visible: false},*/
        {key: 3, label: `钢瓶瓶号`, visible: true},
        {key: 4, label: `钢瓶状态`, visible: true},
        {key: 5, label: `应充介质`, visible: false},
       /* {key: 7, label: `钢瓶重量`, visible: false},
        {key: 8, label: `钢瓶容积`, visible: false},*/
        {key: 6, label: `所属气站`, visible: true},
        /*{key: 7, label: `钢瓶生产日期`, visible: false},
        {key: 8, label: `钢瓶报废日期`, visible: false},
        {key: 9, label: `气瓶制造单位`, visible: false},*/
        {key: 7, label: `下次检验期限`, visible: false},
        {key: 8, label: `瓶体外观检查`, visible: true},
        {key: 9, label: `涂色`, visible: false},
        {key: 10, label: `油污`, visible: false},
        {key: 11, label: `余压`, visible: true},
        {key: 12, label: `不明气体分析`, visible: false},
        {key: 13, label: `出口螺纹样式`, visible: true},
        {key: 14, label: `充装压力`, visible: true},
        {key: 15, label: `密封情况`, visible: true},
        {key: 16, label: `瓶体是否变形`, visible: true},
        {key: 17, label: `瓶温异常情况`, visible: false},

      ],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 气瓶检测表格数据
      yinspectionList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        idNumber: null,
        workPlace: null,
        sex: null,
        userName: null,
        phone: null,
        posts: null,
        birth: null,
        cylinderNumber: null,
        cylinderStatus: null,
        gasMedia: null,
        weight: null,
        volume: null,
        belongingGasStation: null,
        manufactureDate: null,
        scrapDate: null,
        manufacturingUnits: null,
        nextInspectionDeadline: null,
        visualInspertion: null,
        coloring: null,
        greasyDirt: null,
        residualPressure: null,
        unidentifiedGasAnalysis: null,
        exportThreadStyle: null,
        fillingPressure: null,
        sealingSituation: null,
        deformation: null,
        bottleTemperatureAbnormalities: null,
        userId: null,
        deptId: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
    orderByColumn: "note1",
      isAsc: "desc"
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          {required: true, message: "姓名不能为空", trigger: "blur"},
        ],
        workPlace: [
          {required: true, message: "工作单位不能为空", trigger: "blur"},
        ],
        userName: [
          {required: true, message: "工号不能为空", trigger: "blur"},
        ],

        cylinderNumber: [
          {required: true, message: "瓶号不能为空", trigger: "blur"},
        ],
        gasMedia: [
          {required: true, message: "应充介质不能为空", trigger: "blur"},
        ],
        cylinderStatus: [
          {required: true, message: "钢瓶状态不能为空", trigger: "blur"},
        ],
        belongingGasStation: [
          {required: true, message: "所属气站不能为空", trigger: "blur"},
        ],

        manufacturingUnits: [
          {required: true, message: "气瓶制造单位", trigger: "blur"},
        ],
        visualInspertion: [
          {required: true, message: "瓶体外观检查不能为空", trigger: "blur"},
        ],
        deformation: [
          {required: true, message: "瓶体是否变形不能为空", trigger: "blur"},
        ],
        sealingSituation: [
          {required: true, message: "密封情况不能为空", trigger: "blur"},
        ],
        fillingPressure: [
          {required: true, message: "充装压力不能为空", trigger: "blur"},
        ],

      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询气瓶检测列表 */
    getList() {
      this.loading = true;
      listYinspection(this.queryParams).then(response => {
        this.yinspectionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        idNumber: null,
        workPlace: null,
        sex: null,
        userName: null,
        phone: null,
        posts: null,
        birth: null,
        cylinderNumber: null,
        cylinderStatus: null,
        gasMedia: null,
        weight: null,
        volume: null,
        belongingGasStation: null,
        manufactureDate: null,
        scrapDate: null,
        manufacturingUnits: null,
        nextInspectionDeadline: null,
        visualInspertion: null,
        coloring: null,
        greasyDirt: null,
        residualPressure: null,
        unidentifiedGasAnalysis: null,
        exportThreadStyle: null,
        fillingPressure: null,
        sealingSituation: null,
        deformation: null,
        bottleTemperatureAbnormalities: null,
        userId: null,
        deptId: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加气瓶检测";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getYinspection(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改气瓶检测";
      });
    },
    handleView(row) {
      const id = row.id;
      this.$router.push({path: "/qiping/yzxqpjcxq", query: {id}});
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateYinspection(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addYinspection(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除气瓶检测编号为"' + ids + '"的数据项？').then(function () {
        return delYinspection(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/yinspection/export', {
        ...this.queryParams
      }, `yinspection_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
